package com.jingxi.rest.controller;

import com.jingxi.common.pojo.JingXiResult;
import com.jingxi.rest.model.TbContent;
import com.jingxi.rest.service.ContentService;
import org.apache.ibatis.reflection.ExceptionUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/content")
public class ContentCotroller {
    @Autowired
    private ContentService contentService;
    @RequestMapping("/list/{contentCategoryId}")
    @ResponseBody
    public JingXiResult getContentList(@PathVariable Long contentCategoryId){
        try{
            List <TbContent>list=contentService.getContentList(contentCategoryId);
            return JingXiResult.ok(list);
        }catch (Exception e){
            e.printStackTrace();
            return JingXiResult.build(500,"查询失败");
        }

    }
}
